﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.getbespelled" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;
namespace SIPO.Web.AjaxHandler.Loaddata
{

    public class getbespelled : SIPO.Web.BaseHandler
    {
        recInvoiceRepo recInvoiceDal = new recInvoiceRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);
            
            string bespelled = string.Empty;

            decimal invoicevalue = Convert.ToDecimal(context.Request.Params["invoicevalue"]);
            recInvoice invoice = recInvoiceDal.GetBeSpelledByInvoiceValue(invoicevalue);

            if (invoice != null)
                bespelled = invoice.BeSpelled;
            
            StringBuilder sbProject = new StringBuilder();

            sbProject.Append("{");
            sbProject.AppendFormat("  {0}BeSpelled{0}:{0}{1}{0}", "\"", bespelled);
            sbProject.Append("}");

            context.Response.Write(sbProject.ToString());
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}